//
//  StackView.swift
//  EastNetWorkProject
//
//  Created by 伊伊 on 2023/12/29.
//

import Foundation
import UIKit


class VStackView:UIStackView{
    init(_ space:CGFloat,view:() -> [UIView]) {
        super.init(frame: .zero)
        self.spacing = space
        self.alignment = .center
        self.axis = .vertical
        self.backgroundColor = .white
        let array = view()
        array.forEach { view in
            self.addArrangedSubview(view)
        }
    }
    required init(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

class HStackView:UIStackView{
    init(_ space:CGFloat,view:() -> [UIView]) {
        super.init(frame: .zero)
        self.spacing = space
        self.alignment = .center
        self.axis = .horizontal
        self.backgroundColor = .white
        let array = view()
        array.forEach { view in
            self.addArrangedSubview(view)
        }
    }
    required init(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
